package org.example.util.parser;

import org.example.exception.BusinessException;

public class DocParserFac {
    private final String fileOriginalName;

    public DocParserFac(String fileOriginalName) {
        this.fileOriginalName = fileOriginalName;
    }

    public ParserInter getParser() {
        String[] split = fileOriginalName.split("\\.");
        return switch (split[1]) {
            case "doc" -> new DocParser();
            case "docx" -> new DocxParser();
            default -> throw new BusinessException("不支持的解析类型");
        };
    }
}